from .models import Player, Team
from django.contrib import admin
from nba.admin_site import my_site
# Register your models here.


@admin.register(Team, site=my_site)
class TeamAdmin(admin.ModelAdmin):
    list_display = ['name']


@admin.register(Player, site=my_site)
class PlayerAdmin(admin.ModelAdmin):
    list_display = ['name', 'season', 'player_id', 'team', 'games', 'mins', 'points',
                    'rebs', 'assists', 'steals', 'blocks', 'fgpct', 'tpm', 'tppct', 'ftpct']
    list_filter = ['season', 'team', 'name']  # 过滤字段为前3个字段
    search_fields = ['name']
    readonly_fields = list_display
    save_on_top=False
    save_on_bottom=False
    save_as = False
    save_as_continue = False
